<!DOCTYPE html>
<!-- ng-app -->
<html lang="en" ng-app="app">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="../../../js/plugins/angular/angular.min.js" type="text/javascript"></script>
</head>
<body>
    <div ng-controller="cont">
        <div>{{result}}</div>
        <button ng-click="confirm('您真的要删除这条记录吗？')">删除</button>
    </div>

    <script>
        angular.module('app',[])
            .service('$notify',['$window',function ($win) {
                return function (msg) {
                    return $win.confirm(msg) ? "确定" : "取消";
                }
            }])
            .controller('cont',['$scope','$notify',function ($scope,$notify) {
                $scope.confirm = function (msg) {
                    $scope.result = $notify(msg);
                }
            }])

    </script>
</body>
</html>